﻿@model Video
@{
    ViewBag.Title = Model == null ? "Add New Video" : "Edit Video";
    
}
@if (Model == null)
{
    <p>Add a new video by uploading the video file from your computer, and specifying the needed details below.</p>
}
else
{
    <p>You may edit the details of the video below.</p>
}

@using (Html.BeginForm("Edit", "Video", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true, "Please correct the errors below and try again.")
    <div>
        <fieldset>
            <legend>Video Details</legend>

            <div class="editor-label">
                @Html.LabelForWithReq(m => m.Title)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Title)
                @Html.ValidationMessageFor(m => m.Title)
            </div>

            <div class="editor-label">
                @Html.LabelForWithReq(m => m.Teaser)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(m => m.Teaser, new { @class = "adminBasicText" })
            </div>
            <div class="editor-label">
                @Html.LabelForWithReq(m => m.Description)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(m => m.Description, new { @class = "adminRichText" })
            </div>

            <div class="editor-label">
                @Html.LabelForWithReq(m => m.Price)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Price, new { @class = "price" })
                @Html.ValidationMessageFor(m => m.Price)
            </div>

            <div class="editor-label check">
                @{ object htmlAttributes = (Model == null) ? new { @checked = "checked" } : null; }
                @Html.LabelFor(m => m.Active) @Html.CheckBoxFor(m => m.Active, htmlAttributes)
            </div>

            <div class="editor-label check">
                @{ object featuredAttr = (Model != null && Model.Featured) ? new { @checked = "checked" } : null; }
                @Html.LabelFor(m => m.Featured) @Html.CheckBoxFor(m => m.Featured, featuredAttr) <span class="note">(Displays video on home page)</span>
            </div>

            @Html.Partial("RelatedProductSelect", Model)

            <h4>Video File Details</h4>
            <div class="editor-label">
                @Html.LabelForWithReq(m => m.Width) <span class="note">(pixels)</span>
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Width, new { @class = "wh" })
                @Html.ValidationMessageFor(m => m.Width)
            </div>
            <div class="editor-label">
                @Html.LabelForWithReq(m => m.Height) <span class="note">(pixels)</span>
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Height, new { @class = "wh" })
                @Html.ValidationMessageFor(m => m.Height)
            </div>

            <div class="editor-label">
                @if (Model == null)
                {
                    <label>Select File</label> <span class="req">*</span>
                }
                else
                {
                    @Html.HiddenFor(m => m.FileName)
                    @Html.HiddenFor(m => m.MimeType)      
                                  
                    <label>Overwrite Existing File</label> <span class="note">(optional)</span>
                }
            </div>
            <div class="editor-field">
                <input type="file" name="videofile" /> <span class="note"><strong>Note:</strong> Only WMV, MPEG-4 and H.264 video files are supported.</span>
            </div>

            <p class="buttons">
                <input type="submit" value="Submit" />
            </p>
        </fieldset>
    </div>
}